package biz

import (
	"database/sql"
	"gorm.io/gorm"
)

const Duration = 2 * 30 * 24 * 3600
const Secret = "yoursecretkey"

type Customer struct {
	//业务逻辑
	CustomerWork
	CustomerToken
	//嵌入4个基础字段
	gorm.Model
}
type CustomerWork struct {
	Telephone string         `gorm:"type:varchar(15);uniqueIndex" json:"telephone"`
	Name      sql.NullString `gorm:"type:varchar(255);uniqueIndex;" json:"name"`
	Email     sql.NullString `gorm:"type:varchar(255);uniqueIndex;" json:"email"`
	Wechat    sql.NullString `gorm:"type:varchar(255);uniqueIndexl" json:"wechat"`
	CityId    uint           `gorm:"index;" json:"city_id"`
}
type CustomerToken struct {
	Token         string       `gorm:"type:varchar(4095);" json:"token"`
	TokenCreateAt sql.NullTime `gorm:"" json:"token_create_at"`
}

func (*Customer) Table() string {
	return "customers"
}
